import request, { Canceler } from './index';

export type { Canceler };

/*eslint no-unused-vars: 0*/
export async function getData(cancelCallBack?: (cancel: Canceler) => void) {
  type TestData = { list: unknown[] };
  return await request<TestData>({
    url: '/2213077',
    cancel: (c) => cancelCallBack && cancelCallBack(c)
  });
}

export interface ITemplateItem {
  id: string;
  cover: string;
  title: string;
  author: string;
  read: number;
}
export async function getHomeTemplateList() {
  const res = await request<ITemplateItem[]>({ url: '/2213079' });
  return res.data;
}

export async function getTemplateDetail(id: string) {
  const res = await request<ITemplateItem>({ url: `/2213088` });
  return res.data;
}
